<!--
 * @Description:提醒历史
 * @Autor: 刘诗文
 * @Date: 2020-12-17 15:27:31
 * @LastEditors: 何兴家
 * @LastEditTime: 2021-03-01 11:15:03
-->
<template>
  <div>
    <FilterTable
      ref="table"
      height="500"
      selectionType="single"
      :columns="columns"
      :fetchapi="fetchapi"
      :params="fetchParams"
      :datakey="'rows'"
      columnsRef="remindHistorylsw"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="onRowSelectChange"
    >
    </FilterTable>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import { getRemindRecord } from '@/api/customerRepair/customerCare/vehicleRemind';
export default {
  name: 'remindHistory',
  mixins: [dictionary],
  props: ['formData'],
  data() {
    this.selectedData = null;
    this.BaseTable = null;
    return {
      columns: this.createTableColumns(),
      fetchapi: getRemindRecord,
      fetchParams: { pageNum: 1, xhrAbort: false, ownerNo: this.formData.ownerNo, vin: this.formData.vin }
    };
  },
  mounted() {
    this.BaseTable = this.$refs.table;
    console.log(this.formData, 'formData::');
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '车主编号',
          dataIndex: 'ownerNo'
        },
        {
          title: '车主名称',
          dataIndex: 'ownerName'
        },
        {
          title: '车牌号',
          dataIndex: 'license'
        },
        {
          title: 'VIN',
          dataIndex: 'vin'
        },
        {
          title: '提醒人',
          dataIndex: 'reminder'
        },
        {
          title: '提醒时间',
          dataIndex: 'remindDate'
        },
        {
          title: '提醒内容',
          dataIndex: 'remindContent'
        },
        {
          title: '客户反馈',
          dataIndex: 'customerFeedBack'
        },
        {
          title: '提醒方式',
          dataIndex: 'remindWay',
          dictItems: this.createDictList('8081')
        },
        {
          title: '提醒状态',
          dataIndex: 'remindStatus',
          dictItems: this.createDictList('8057')
        },
        {
          title: '提醒失败原因',
          dataIndex: 'remindFailReason',
          dictItems: this.createDictList('8069')
        },
        {
          title: '提醒类型',
          dataIndex: 'reminderType',
          dictItems: this.createDictList('8199')
        },
        {
          title: '备注',
          dataIndex: 'remark'
        }
      ];
    },
    onRowSelectChange(row) {
      if (!row.length) {
        this.selectedData = null;
      } else {
        this.selectedData = row[0];
      }
    }
  }
};
</script>
<style lang="less" scoped></style>
